﻿Imports Microsoft.Practices.Composite.Modularity
Imports Microsoft.Practices.Unity
Imports Microsoft.Practices.Composite.Regions
Imports EHaskins.Frc.Infrastructure

Public Class StandardDataModule
    Implements IModule

    Dim _container As IUnityContainer
    Dim _dashboard As IDashboardController
    Dim _regionManager As IRegionManager

    ''' <summary>
    ''' Initializes a new instance of the OutputModule class.
    ''' </summary>
    ''' <param name="container"></param>
    ''' <param name="dashboard"></param>
    ''' <param name="regionManager"></param>
    Public Sub New(ByVal container As IUnityContainer, ByVal dashboard As IDashboardController, ByVal regionManager As IRegionManager)
        _container = container
        _dashboard = dashboard
        _regionManager = regionManager
    End Sub

    Public Sub Initialize() Implements IModule.Initialize
        _container.RegisterType(Of IStandardDataViewModel, StandardDataViewModel)()

        Dim viewModel = _container.Resolve(Of IStandardDataViewModel)()
        Dim view = viewModel.View
        Dim region = _regionManager.Regions(Regions.MainContent)
        region.Add(view)
        region.Activate(view)
    End Sub
End Class
